package org.xw.service.impl;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.xw.dto.UserDto;
import org.xw.mapper.SearchMapper;
import org.xw.pojo.GzhPojo;
import org.xw.service.SearchService;

import java.util.HashMap;
import java.util.List;

@Service
public class SearchServiceImpl implements SearchService {

    @Autowired
    SearchMapper mapper;

    @Override
    public HashMap search(String content, HttpServletRequest request) {
        List<UserDto> users = mapper.searchUser(content);
        List<GzhPojo> gzh = mapper.searchGzh(content);
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("user", users);
        hashMap.put("gzh", gzh);
        return hashMap;
    }

    @Override
    public UserDto searchUserByPhone(String phone, HttpServletRequest request) {
        UserDto userDto = mapper.searchUserByPhone(phone);
        return userDto;
    }


}
